$(function() {
	$('#vue_vm_list div').hide();
});

var roomAsset = {
	roomAssetId: '',
	buildingId: '',
	buildingName: '',
	floorsId: '',
	floorsName: '',
	roomId: '',
	roomNumber: '',
	assetName: '',
	quantity: '',
	createTime: '',
	updateTime: '',
	createId: getLoginedUser()? getLoginedUser().staffId: '',
	updateId: getLoginedUser()? getLoginedUser().staffId: '',
	assetId: '',
};

findAllAsset();

function findAllAsset() {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list div').hide();

	findAll_basic(path+'/asset/findAll', function(response) {
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			},
			methods: {
				roomAsset_save:function(todo) {
					todo.buildingId = $('#building_select').val();
					todo.buildingName = $('#building_select option:selected').text();
					todo.floorsId = $('#floor_select').val();
					todo.floorsName = $('#floor_select option:selected').text();
					todo.roomId = selectedRoom.roomId;
					todo.roomNumber = selectedRoom.roomNumber;
					todo.roomType = selectedRoom.roomType;
					todo.quantity = parseInt($('#'+todo.assetId+'_quantity').val());
					
					save_basic(path+'/roomAsset/save', {roomAsset:todo}, function() {
						alert('添加成功');
					});
				}
			}
		});
		
		$('#vue_vm_list div').show();
	});
}
